#include<func.h>
int main()
{
    pid_t pid;
    pid=fork();
    if(0==pid)
    {
        printf("I am child,pid=%d,ppid=%d\n",getpid(),getppid());
        char *p=NULL;
        *p=10;
        exit(3);
    }
    else
    {
        printf("I am parent,mychlid=%d,pid=%d,ppid=%d\n",pid,getpid(),getppid());
        int status;
        pid_t pid1=waitpid(pid,&status,0);
        
            if(WIFEXITED(status))
        {
            printf("child exit code=%d\n",WEXITSTATUS(status));

        }
        else
        {
            printf("child crash\n");
        }
        printf("wait pid=%d\n",pid1);
        

        
    }
    return 0;
}